<template>
	<!-- 专业技能 -->
	<view class="box">
		<!-- #ifdef MP-WEIXIN -->
		<view class="head"
			:style="'padding-top:'+statusBarHeight1+'px;padding-right:'+ (WXwidth + 15) +'px;height:' + (statusBarHeight1 + 44) + 'px'">
			<!-- #endif -->
			<!-- #ifndef MP-WEIXIN -->
			<view class="head"
				:style="'padding-top:'+(statusBarHeight1+10)+'px;height:' + (statusBarHeight1 + 54) + 'px'">
				<!-- #endif -->
				<image class="fanhui" @click="fanhui" src="https://pic.bangbangtongcheng.com/static/fanhui_bai.png"
					mode=""></image>
				<view class="centers">
					专业技能
				</view>
				<view class="head_right" @click="fanhui(1)">保存</view>
			</view>
			<!-- #ifdef MP-WEIXIN -->
			<view
				:style="'padding-top:'+statusBarHeight1+'px;height:' + (statusBarHeight1 + 44) + 'px;background-color: #64B6A8;'">
			</view>
			<!-- #endif -->
			<!-- #ifndef MP-WEIXIN -->
			<view
				:style="'padding-top:'+statusBarHeight1+'px;height:' + (statusBarHeight1 + 54) + 'px;background-color: #64B6A8;'">
			</view>
			<!-- #endif -->
			<view class="center">
				<view class="center_item">
					<view class="title">
						技能名称
					</view>
					<view class="neir">
						<input class="inputs" v-model="data.skillName" placeholder="掌握的技能名称" type="text">
					</view>
				</view>
				<view class="center_item">
					<view class="title">
						使用时长
					</view>
					<view class="neir">
						<input class="inputs" v-model="data.duration" placeholder="月" type="number">
					</view>
				</view>
				<view class="center_item">
					<view class="title">
						掌握程度
					</view>
					<view class="neir">
						<input class="inputs" v-model="data.mastery" placeholder="如:精通" type="text">
					</view>
				</view>
			</view>
		</view>
</template>
<script>
	import permision from "@/js_sdk/wa-permission/permission.js"
	//#ifdef H5
	import wxshare from "@/utils/index.js";
	//#endif
	import {
		mapGetters
	} from "vuex";
	export default {
		data() {
			return {
				userInfo: uni.getStorageSync("Pduser"),
				WXwidth: '',
				data:{
					skillName:'',
					duration:'',
					mastery:'',
				},
				index:''
			};
		},
		onLoad(option) {
			var than = this;
			// 获取微信小程序胶囊和据右边宽度
			// #ifdef MP-WEIXIN
			// 获取胶囊信息
			let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
			let getWindowInfo = uni.getWindowInfo().screenWidth
			this.WXwidth = getWindowInfo - (menuButtonInfo.right - menuButtonInfo.width)
			// #endif
			if(option.index){
				this.index = option.index
				this.data = uni.getStorageSync('zyjn_key');
				uni.removeStorageSync('zyjn_key');
			}
			/* #ifdef H5 */
			this.jinzhi();
			/* #endif */
		},
		mounted() {
			
		},
		computed: {
			...mapGetters(["userid", "islogin", "statusBarHeight1", "userinfo"])
		},
		methods: {
			fanhui(index){
				if(index == '1'){
					if(this.data.skillName == '' || this.data.duration == '' ||this.data.mastery == ''){
						uni.showToast({
							title: "请完善专业能力",
							icon: "none",
							mask: true,
						});
						return
					}
					if(this.index){
						let pages = getCurrentPages();
						let prevPage = pages[ pages.length - 2 ];  
						this.$set(prevPage.$vm.professionalSkills,this.index,this.data)
					}else{
						let pages = getCurrentPages();
						let prevPage = pages[ pages.length - 2 ];  
						prevPage.$vm.professionalSkills.push(this.data)
					}   
				}
				uni.navigateBack({  
				    delta: 1
				});
			},
			jinzhi() {
				let _this = this;
				let param = window.location.href.split("#")[0];
				uni.request({
					method: "post",
					data: {
						url: param
					},
					header: {
						"content-type": "application/x-www-form-urlencoded",
					},
					url: "https://www.bangbangtongcheng.com/conven//mob/login/getJsTicket.do",
					success(re) {
						_this.jinzhifx(re.data);
					},
				});
			},
			jinzhifx(data) {
				wxshare.config({
					debug: false, //是否打开调试
					appId: data.appId, // 公众号的唯一标识
					timestamp: data.timestamp, // 生成签名的时间戳
			 	nonceStr: data.nonce, // ，生成签名的随机串
					signature: data.signature, // 签名
					jsApiList: ["hideMenuItems"],
				});
				// 禁止分享
				wxshare.hideMenuItems({
					// 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
					menuList: [
						"menuItem:share:appMessage",
						"menuItem:share:timeline",
						"menuItem:share:timeline",
						"menuItem:share:qq",
						"menuItem:favorite",
						"menuItem:share:QZone",
						"menuItem:openWithSafari",
					],
				});
			},
		},
	};
</script>
<style lang="less" scoped>
	.box {
		width: 100%;
		min-height: 100vh;
		background-color: #fff;
	}

	.head {
		position: fixed;
		top: 0;
		left: 0;
		width: 750rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 15px;
		background-color: #64B6A8;
		z-index: 1000;

		.fanhui {
			width: 40rpx;
			height: 40rpx;
		}

		.centers {
			font-size: 36rpx;
			font-weight: 400;
			color: #FFFFFF;
		}

		.head_right {
			font-size: 30rpx;
			font-weight: 400;
			color: #FFFFFF;
		}
	}
	.center{
		padding: 0 40rpx;
		.center_item{
			height: 190rpx;
			padding-top: 50rpx;
			.title{
				font-size: 26rpx;
				font-weight: 400;
				color: #333333;
			}
			.neir{
				height: 104rpx;
				display: flex;
				align-items: center;
				.inputs{
					flex: 1;
					height: 100%;
					border-bottom: 1px solid #e0e0e0;
				}
				.xian{
					width: 36rpx;
					height: 1px;
					background-color: #333;
					margin: 0 20rpx;
				}
			}
		}
	}
</style>
